<%@page import="com.lfs.Utils.PageModel"%>
<%@page import="java.util.List"%>
<%@page import="com.lfs.Entity.ProductEntity"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>  <!-- 导入c标签库 -->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/productlist.css" type="text/css">
</head>
<body> 
 <%   
    PageModel<ProductEntity>  pm = (PageModel<ProductEntity>)request.getAttribute("page");
    if(pm == null){
    	response.sendRedirect("ProductServlet?status=ProductSelectAll");  
        return;
    }
    List<ProductEntity> list = pm.getProductlist();
    if(list == null || list.isEmpty()){
 %><div>暂无商品信息</div>
<%
    }else{
    	
    	 for(ProductEntity pe: list){
    	%> 
    	 <%-- <div style="width: 300px;height: 300px;"><img src="upload/<%=pe.getImg()%>"/> </div> --%>
     <div class="content">
           <a class="card" href=""> 
         <div class="front" style="background-image: url(upload/<%=pe.getImg()%>);">
             <p style="color: #000000"> 商品名称：<%=pe.getName()%><br> 商品剩余数量：<%=pe.getNumber()%> <br> 商品价格：<%=pe.getPrice() %></p>
         </div>
    <div class="back">
       <div>
            <p></p>
            <p>商品描述<%=pe.getDescribe()%></p>
            <form action="ProductServlet?status=ProductSelect&id=<%=pe.getId()%>" method="post">
        	   <button class="button" type="submit" onclick="window.location='new_file.html'">查看详情</button>
        	   <table  class="down">
        	        <tr><td> <a href="ProductServlet?status=PImgDown&img=<%=pe.getImg()%>" style="text-decoration: none;color:#fff;"> Down</a>      </td></tr>
        	   </table>
        	</form>
      </div>
       </div>  
  </a>
    </div>
     <a href="ProductServlet?status=ProductDelect&id=<%=pe.getId()%>" class="a1">删除</a>
    	<% 
    	 }
    }
%>  
<div class="page" style="background-color: #ecf0f9;">
     <a href="ProductServlet?status=ProductSelectAll&currentPage=<%=pm.prePage()%>">上一页</a>
     <%
       for(int i=1;i<=pm.getTotlePage();i++){
        %> 
         <a href="ProductServlet?status=ProductSelectAll&currentPage=<%=i%>"><%=i %></a>
        <%
       }
     %>
      <a href="ProductServlet?status=ProductSelectAll&currentPage=<%=pm.nextPage() %>">下一页</a>
             共<%=pm.getTotlePage() %>页
</div> 
<div class="page"><a href="ProductAdd.jsp" style="border: none;">添加商品</a></div> 
</body>
</html>